package com.personal.gateway.dto;

import com.alibaba.fastjson.annotation.JSONField;
import com.personal.gateway.custom.customEnum.LoginTypeEnum;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * @author BigHead
 * @date 2021/11/24 16:19
 * @description UserLoginDot
 */
@Data
public class UserLoginDto {

    @JSONField
    private String uid;
    @JSONField
    private String captcha;
    @JSONField
    private String account;
    @JSONField
    private String password;
    @JSONField(name = "response_code")
    private int responseCode;
    @JSONField(name = "response_message")
    private String responseMessage;
    @JSONField(name = "response_token")
    private String responseToken;

    public boolean checkParameter() {
        if (StringUtils.isBlank(uid) || StringUtils.isBlank(captcha) || StringUtils.isBlank(account) || StringUtils.isBlank(password)) {
            this.setResponseCode(LoginTypeEnum.PARAMETER_ERROR.getTypeValue());
            this.setResponseMessage(LoginTypeEnum.PARAMETER_ERROR.getTypeMessage());
            return true;
        } else {
            return false;
        }
    }

}
